# This uses a dictionary to generate mailing lists. 
# Two areas where this could fail is if your users
# in the lists are not in your domain. Or if you 
# have duplicate users in a list's membership.

# I used another script (vbscript running on a 
# AD Domain Controller)to generate the dictionary.

mlists = {'list1':['user1','user2','user3'],
          'list2':['user3','user5','user6'],
          'list3':['user1','user2','user6'],
          'list4':['user6','user5','user4']}

domain = 'some.org'                    
adminid = 'admin@some.org''
import gdata.apps.service
import getpass

password = getpass.getpass()
service = gdata.apps.service.AppsService(domain=domain) 
service.ClientLogin(adminid, password)

# # cleaning up if necessesary
# for alist in mlists.keys():
#   service.DeleteEmailList(alist)

for alist in mlists.keys():
  service.CreateEmailList(alist)
  print '*****'
  print alist
  for member in mlists[alist]:
    service.AddRecipientToEmailList(member, alist)
    print member